package com.haixue.android.academy.adapter;

import android.academy.haixue.com.haixue.R;
import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.haixue.android.academy.domain.Categorys;
import com.haixue.android.academy.utils.BaseHolder;

import butterknife.InjectView;

/**
 * Created by ren on 2015/6/4 0004.
 */
public class CategoryAdapter extends  CustomBaseAdapter<Categorys> {
    public CategoryAdapter(Context context) {
        super(context);
    }

    @Override
    public View getView(int i, View convertView, ViewGroup viewGroup) {
        ViewHolder holder;
        if (convertView != null) {
            holder = (ViewHolder) convertView.getTag();
        } else {
            convertView =layoutInflater.inflate(R.layout.item_category, null);
            holder = new ViewHolder(context,convertView);
            convertView.setTag(holder);
        }

        Categorys data = getData(i);

        holder.textView_category.setText(data.getName());
        return convertView;
    }
    static class ViewHolder extends BaseHolder{
        @InjectView(R.id.textView_category)
        TextView textView_category;

        public ViewHolder(Context context,View view) {
            super(context,view);
        }
    }

}
